﻿(function () {

    $(document).ready(function () {
        $("#quick").autocomplete({
            source: function (request, response) {
                $.ajax({
                    url: "/QuickFind/Assertion", type: "POST", dataType: "json",
                    data: { searchText: request.term, maxResults: 10 },
                    success: function (data) {
                        var mappedData = $.map(data,
                                function (item) {
                                    return {
                                        label: item.Title,
                                        value: item.Title,
                                        id: item.Id
                                    }
                                });

                        response(mappedData);
                    }
                });
            },
            minLength: 2
        });
    });


} ());